<template>
	<scroll-view scroll-y="true" class="business-info-main" v-show="isShow">
		<view class="row-area" v-if="infoData.phone" @click="makePhoneCall(infoData.phone)">
			<view class="col1 cellphone-icon"></view>
			<view class="col2"><text>{{infoData.phone}}</text></view>
		</view>
		<view class="row-area" v-if="infoData.address" @click="businessMap()">
			<view class="col1 address-icon"></view>
			<view class="col2"><text selectable="true">{{infoData.address}}</text></view>
		</view>
		<view class="row-area" v-if="infoData.full_notice">
			<view class="col1 notice-icon"></view>
			<view class="col2">
				<rich-text :nodes="infoData.full_notice|htmlToArray"></rich-text>
			</view>
		</view>
	</scroll-view>
</template>

<script>
	export default {
		name: "business-info",
		props: {
			isShow: {
				type: Boolean,
				default: false
			},
			//商家信息
			infoData: {
				type: Object,
				default: () => {}
			},
			//分店的id
			branchShopId: {
				type: String,
				default: ""
			}
		},
		methods: {
			//拨打电话
			makePhoneCall(number) {
				uni.makePhoneCall({
					phoneNumber: number
				});
			},
			//商家位置
			businessMap() {
				if (this.infoData.lng && this.infoData.lat) {
					this.pushPage('/pages/business_map/index?branch_shop_id=' + this.branchShopId + '&lng=' + this.infoData
						.lng + '&lat=' + this.infoData.lat + '');
				}
			},
			pushPage(url) {
				uni.navigateTo({
					url
				})
			}
		}
	}
</script>

<style scoped>
	.business-info-main {
		width: 100%;
		height: 55vh;
		font-size: 28rpx;
	}

	.business-info-main .row-area {
		width: 100%;
		height: auto;
		display: flex;
		box-sizing: border-box;
		padding: 10rpx 22rpx;
	}

	.business-info-main .col1 {
		width: 35rpx;
		height: 35rpx;
	}

	.business-info-main .col2 {
		width: 700rpx;
		overflow: hidden;
	}

	.business-info-main .col1.cellphone-icon {
		background-image: url("~@/static/images/goods/cellphone.png");
		background-size: 100%;
		background-repeat: no-repeat;
		background-position: center;
		margin-right: 10rpx;
	}

	.business-info-main .col1.address-icon {
		background-image: url("~@/static/images/goods/address.png");
		background-size: 100%;
		background-repeat: no-repeat;
		background-position: center;
		margin-right: 10rpx;
	}

	.business-info-main .col1.notice-icon {
		background-image: url("~@/static/images/goods/notice.png");
		background-size: 100%;
		background-repeat: no-repeat;
		background-position: center;
		margin-right: 10rpx;
	}

	.points-tip {
		width: 75%;
		height: 25px;
		position: fixed;
		z-index: 1;
		left: 23%;
		bottom: 95rpx;
		background-color: #FFFFFF;
		text-align: center;
		line-height: 25px;
		font-size: 28rpx;
		color: #E30019;
		border-radius: 5px;
		border: 1px solid #f6ab00;
		overflow: hidden;
		white-space: nowrap;
		text-overflow: ellipsis;
	}
</style>